home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-18 | 863 b | 42 lines | [TEXT/MPS ] |
- #define SystemSevenOrLater 1
-
- #include "directoryloop.h"
-
- directoryloop::directoryloop( const FSSpec& directory )
- {
- pb.hFileInfo.ioCompletion= 0;
-
- pb.hFileInfo.ioNamePtr= (StringPtr)&directory.name;
- pb.hFileInfo.ioVRefNum= directory.vRefNum;
- pb.hFileInfo.ioDirID= directory.parID;
- pb.hFileInfo.ioFDirIndex= 0;
-
- error= PBGetCatInfoSync( &pb );
- if (iswrong())
- return;
-
- dirid= pb.hFileInfo.ioDirID;
-
- pb.hFileInfo.ioNamePtr= (StringPtr)&thename;
- pb.hFileInfo.ioFDirIndex= 1;
- error= PBGetCatInfoSync( &pb );
- }
-
- void directoryloop::next()
- {
- pb.hFileInfo.ioDirID= dirid;
- pb.hFileInfo.ioFDirIndex++;
- error= PBGetCatInfoSync( &pb );
- }
-
- OSErr directoryloop::makespec( FSSpec& spec )
- {
- if (iswrong())
- return whatiswrong();
-
- return FSMakeFSSpec( pb.hFileInfo.ioVRefNum,
- dirid,
- (ConstStr255Param)&thename,
- &spec );
- }
-